﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dukou.Dao;
using Dukou.Domain;
using Spring.Transaction.Interceptor;

namespace Dukou.BizService.Implement
{
    /// <summary>
    /// 枚举业务服务
    /// </summary>
    [Serializable]
    public class EnumerationBizService : EntityBizService<IEnumerationDao, Enumeration, Int64>, IEnumerationBizService
    {
        /// <summary>
        /// 获取 / 设置 枚举分类 DAO
        /// </summary>
        public IEnumerationCategoryDao EnumerationCategoryDao { get; set; }

        /// <summary>
        /// 保存枚举分类
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        [Transaction(ReadOnly=false)]
        public long Save(EnumerationCategory category)
        {
            return this.EnumerationCategoryDao.Save(category);
        }

        /// <summary>
        /// 保存或更新枚举分类
        /// </summary>
        /// <param name="category"></param>
        [Transaction(ReadOnly = false)]
        public void SaveOrUpdate(EnumerationCategory category)
        {
            this.EnumerationCategoryDao.SaveOrUpdate(category);
        }

        /// <summary>
        /// 更新枚举分类
        /// </summary>
        /// <param name="category"></param>
        [Transaction(ReadOnly = false)]
        public void Update(EnumerationCategory category)
        {
            this.EnumerationCategoryDao.Update(category);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        [Transaction(ReadOnly = false)]
        public void Delete(EnumerationCategory entity)
        {
            this.EnumerationCategoryDao.Delete(entity);
        }

        /// <summary>
        /// 获取枚举分类
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public EnumerationCategory FindCategoryById(long id)
        {
            return this.EnumerationCategoryDao.FindById(id);
        }

        /// <summary>
        /// 获取枚举分类
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public EnumerationCategory FindCategoryByName(string name)
        {
            return this.EnumerationCategoryDao.FindByName(name);
        }

        /// <summary>
        /// 获取枚举
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public IList<Enumeration> SelectByCategory(string category)
        {
            return this.EntityDao.SelectByCategory(category);
        }

        /// <summary>
        /// 获取枚举
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public IList<Enumeration> SelectByCategory(EnumerationCategory category)
        {
            return this.EntityDao.SelectByCategory(category);
        }
    }
}
